struct SpriteLocation
{
    SpriteLocation() {}
    SpriteLocation(const Vec2i &_coord, UINT _spriteID, UINT _spriteLayer)
    {
        coord = _coord;
        spriteID = _spriteID;
        spriteLayer = _spriteLayer;
    }

    Vec2i coord;
    UINT spriteID;
    UINT spriteLayer;
};

inline bool operator < (const SpriteLocation &a, const SpriteLocation &b)
{
    return (a.spriteLayer < b.spriteLayer);
}

struct Frame
{
public:
    void Render(Bitmap &target, const SpriteCollection &collection) const;

    ControllerState controller;
    vector<SpriteLocation> sprites;
    vector<int> observedInts;
};

inline OutputDataStream& operator << (OutputDataStream &S, const Frame &F)
{
    S.WriteData(F.controller);
    S.WriteSimpleVector(F.sprites);
    S << F.observedInts;
    return S;
}

inline InputDataStream& operator >> (InputDataStream &S, Frame &F)
{
    S.ReadData(F.controller);
    S.ReadSimpleVector(F.sprites);
    S >> F.observedInts;
    //F.observedInts[0] = rand() % 2; // test case to see how learning works on random variables
    return S;
}